package com.tqz.rc.spring.cloud.discovery;

import com.tqz.rc.spring.cloud.TqzRcProperties;
import com.tqz.rc.spring.cloud.TqzRcServiceManager;
import com.tqz.rc.spring.cloud.registry.TqzRcServiceRegistryAutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <p>服务发现自动配置类
 *
 * @author tianqingzhao
 * @since 2021/9/3 15:07
 */
@Configuration
@AutoConfigureAfter(TqzRcServiceRegistryAutoConfiguration.class)
public class TqzRcDiscoveryAutoConfiguration {

    @Bean
    @ConditionalOnBean(TqzRcProperties.class)
    public TqzRcServiceDiscovery tqzRcServiceDiscovery(
            TqzRcProperties tqzRcProperties,
            TqzRcServiceManager tqzRcServiceManager) {
        return new TqzRcServiceDiscovery(tqzRcProperties, tqzRcServiceManager);
    }

}
